<?php

/**
 * DocLigne form base class.
 *
 * @method DocLigne getObject() Returns the current form's model object
 *
 * @package    symfony
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDocLigneForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'designation'            => new sfWidgetFormInputText(),
      'taux_remise'            => new sfWidgetFormInputText(),
      'quantite_livre'         => new sfWidgetFormInputText(),
      'quantite'               => new sfWidgetFormInputText(),
      'poids_net'              => new sfWidgetFormInputText(),
      'poids_brut'             => new sfWidgetFormInputText(),
      'prix_unitaire_h_t'      => new sfWidgetFormInputText(),
      'prix_total_h_t'         => new sfWidgetFormInputText(),
      'prix_total_t_t_c'       => new sfWidgetFormInputText(),
      'prix_total_t_t_c_n_e_t' => new sfWidgetFormInputText(),
      'prix_t_v_a'             => new sfWidgetFormInputText(),
      'id_article'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Article'), 'add_empty' => true)),
      'id_article_serie'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ArticleSerie'), 'add_empty' => true)),
      'id_doc_entete'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DocEntete'), 'add_empty' => false)),
      'id_t_v_a'               => new sfWidgetFormInputText(),
      'id_maintenance'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Maintenance'), 'add_empty' => true)),
      'id_departement'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UniteLogistique'), 'add_empty' => true)),
      'id_unite_logistique'    => new sfWidgetFormInputText(),
      'r'                      => new sfWidgetFormInputText(),
      'q'                      => new sfWidgetFormInputText(),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'designation'            => new sfValidatorString(array('max_length' => 100)),
      'taux_remise'            => new sfValidatorNumber(),
      'quantite_livre'         => new sfValidatorNumber(),
      'quantite'               => new sfValidatorNumber(),
      'poids_net'              => new sfValidatorNumber(),
      'poids_brut'             => new sfValidatorNumber(),
      'prix_unitaire_h_t'      => new sfValidatorNumber(),
      'prix_total_h_t'         => new sfValidatorNumber(),
      'prix_total_t_t_c'       => new sfValidatorNumber(),
      'prix_total_t_t_c_n_e_t' => new sfValidatorNumber(),
      'prix_t_v_a'             => new sfValidatorNumber(),
      'id_article'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Article'), 'required' => false)),
      'id_article_serie'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ArticleSerie'), 'required' => false)),
      'id_doc_entete'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('DocEntete'))),
      'id_t_v_a'               => new sfValidatorInteger(array('required' => false)),
      'id_maintenance'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Maintenance'), 'required' => false)),
      'id_departement'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('UniteLogistique'), 'required' => false)),
      'id_unite_logistique'    => new sfValidatorInteger(array('required' => false)),
      'r'                      => new sfValidatorInteger(),
      'q'                      => new sfValidatorNumber(),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('doc_ligne[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DocLigne';
  }

}
